//
//  FeedViewController.swift
//  CoolImageFound
//
//  Created by  iBrother 李彦兵 on 2018/6/9.
//  Copyright © 2018  iBrother 李彦兵. All rights reserved.
//

import UIKit

class FeedViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource  {
    
    var flowLayout: ModetailWaterFlow!
    var collectionView: UICollectionView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        flowLayout = ModetailWaterFlow()
        collectionView = UICollectionView(frame: view.bounds, collectionViewLayout: flowLayout)
        collectionView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        collectionView.backgroundColor = UIColor.black
        collectionView.alwaysBounceVertical = true
        collectionView.delegate = self
        collectionView.dataSource = self
        view.addSubview(collectionView)
        
        let nib = UINib(nibName: "DetailCell", bundle: nil)
        collectionView.register(nib, forCellWithReuseIdentifier: "DetailCell")
//        let cellClass = UICollectionViewCell()
//        collectionView.register(cellClass, forCellWithReuseIdentifier: "Detailcell")
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 20
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "DetailCell", for: indexPath)
        
        return cell
    }
    
}
